<template>
	<view>
		<view  style="background: linear-gradient( 180deg, #FFEEEB 0%, #F8F8FA 100%);height: 310rpx;">
			<u-navbar title="影片库" placeholder bg-color="transparent" :auto-back="true">
			
		
			</u-navbar>
		
		</view>
		<view class="u-p-20" style="margin-top: -140rpx;">
			<view class="u-bg-fff u-p-30 u-r-20 u-m-b-20" style="padding-bottom: 0;" v-for="(item,index) in list" @click="$u.route('/pages/member/download/detail?id='+item.id)">
				<view class="u-flex u-flex-between" style="border-bottom: 1rpx solid #ECECEC;">
					<view>
						<view class="u-f-30 u-bold">{{item.name}}</view>
						<view class="u-m-t-26 u-f-24" style="color: #646464;">{{$u.timeFormat(item.createtime, 'yyyy-mm-dd')}}</view>
					</view>
					<image :src="item.image" style="width: 192rpx;height: 134rpx;border-radius: 10rpx;"></image>
					
				</view>
					<u-gap height="20rpx"></u-gap>
					<view class="u-flex-y-center u-flex-between" style="align-items: flex-start;">
						<view class="u-flex-y-center">
								<view :style="item.type==1?'color: #19C898;':'color: #EA4D44;'" class="u-f-26">{{item.type==1?'胜利':'失败'}}</view>
							<view class="u-flex-y-center u-m-l-30">
								<image src="/static/down_bi.png" style="width: 26rpx;height: 26rpx;margin-right: 12rpx;"></image>
								<view style="color: #F09639;" class="u-f-26">获得{{item.score}}经验值</view>
							</view>
						</view>
						<view >
							<image src="/static/down_btn.png" style="width: 174rpx;height: 66rpx;"></image>
							<view class="u-c-fff u-f-26 u-p-r" style=" top: -52rpx;left: 34rpx;">下载/预览</view>
						
						</view>
					</view>
			</view>
		</view>
	</view>
</template>


<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
			}
		},
		onShow(opt) {
			const isLogin = getApp().checkLogin(true, false)
			if (!isLogin) return
			this.page = 1
			this.list = []
			this.getList()
		},
		onReachBottom() {
			this.getList()
		},
		methods: {
			async getList() {
				if (this.page == -1) {
					return
				}

				let url = 'user/battle'
				let res = await uni.$u.http.post(url, {
					page: this.page
					});
				let ls = getApp().mergePage(res, this.page, this.list);
				this.list = ls.list
				this.page = ls.total
			},
		}


	}
</script>

<style>
	page{
		background: #F8F8FA;
	}
</style>